import 'package:shared_preferences/shared_preferences.dart';

const uniqueToken = 'boarding-pass'; // 唯一token标识

// 存储token
Future<bool> setToken(String value) async {
  SharedPreferences pref = await SharedPreferences.getInstance();
  return pref.setString(uniqueToken, value);
}

// 取出token
Future<String> getToken() async {
  SharedPreferences pref = await SharedPreferences.getInstance();
  return pref.getString(uniqueToken) ?? '';
}

// 清除token
Future<bool> clearToken() async {
  SharedPreferences pref = await SharedPreferences.getInstance();
  return pref.remove(uniqueToken);
}
